<script  lang="ts" setup name= "APP">
//省去了之前注册组件的步骤  因为setup会自动return
import { ref } from "vue";
import person0 from "./components/person.vue";
let num = ref();
let ren = ref();
let changefn = () => {
  console.log(num.value);
};
// 获取实例对象函数，默认没有东西  儿子的日记不让看  因此需要在儿子中开启日记权限  借助defineExpose
let changefnbutton = () => {
  console.log(ren.value.a);  //这是取出的方式
};
</script>

<template>
  <person0 ref="ren" />
  <div ref="num" @click="changefn">数量app</div>
  <button @click="changefnbutton">获取实例对象</button>
</template>

<style scoped>
header {
  line-height: 1.5;
}

.logo {
  display: block;
  margin: 0 auto 2rem;
}

@media (min-width: 1024px) {
  header {
    display: flex;
    place-items: center;
    padding-right: calc(var(--section-gap) / 2);
  }

  .logo {
    margin: 0 2rem 0 0;
  }

  header .wrapper {
    display: flex;
    place-items: flex-start;
    flex-wrap: wrap;
  }
}
</style>
